<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        body,
        html{
            overflow: hidden;
            width: 100%;
            height: 100%;
            margin: 0;
            font-family: "微软雅黑";
        }
        #container {
            overflow: hidden;
            width: 60%;
            height: 40%;
            margin: 0 auto;
            font-family: "微软雅黑";
        }
    </style>
</head>

<body>
<div id="container">

</div>
<input type="hidden" value="江苏省苏州市工业园区职业技术学院" id="result">
<!--<div id='result'>江西省上饶市广信区第三小学</div>-->
<script src="//api.map.baidu.com/api?type=webgl&v=3.0&ak=YdcyBdAMy2CPVhN4Eo0E4falnPff1Pna"></script>
<script>
    // let map = new BMapGL.Map('container');
    // map.centerAndZoom(new BMapGL.Point(114.06553503196786, 22.658620030568334), 15);
    // map.enableScrollWheelZoom(true);
    // // 创建点标记
    // let marker1 = new BMapGL.Marker(new BMapGL.Point(114.06553503196786, 22.658620030568334));
    // // // 在地图上添加点标记
    // map.addOverlay(marker1);
    let addressReal = document.getElementById("result").value;
    var map = new BMapGL.Map('container');
    map.centerAndZoom(new BMapGL.Point(116.331398,39.897445), 18);
    map.enableScrollWheelZoom(true);
    //创建地址解析器实例
    var myGeo = new BMapGL.Geocoder();
    // 将地址解析结果显示在地图上，并调整地图视野
    console.log(addressReal)
    myGeo.getPoint(addressReal, function(point){
        if(point){
            map.centerAndZoom(point, 18);
            map.addOverlay(new BMapGL.Marker(point, {title: addressReal}))
        }else{
            alert('您选择的地址没有解析到结果！');
        }
    }, '北京市')
</script>
</body>
</html>